﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using BLL;

namespace EDM
{
    //public class StatusTextService : IStatusTextService
    public partial class StatusTextService : IStatusTextService
    {
        /// <summary>
        /// 根据ID返回
        /// </summary>
       
        public BLL.StatusText GetById(int Id)
        {

            using (TrainingWorkshopEntities db = new TrainingWorkshopEntities())
            {
                StatusText statustextDE = db.StatusTexts.Where(p => p.StatusId == Id).FirstOrDefault();

                BLL.StatusText StatusText = new BLL.StatusText();
                StatusText.StatusId = statustextDE.StatusId;
                StatusText.StatusName = statustextDE.StatusName;
                return StatusText;
            }
        }




        /// <summary>
        /// 返回全部
        /// </summary>
        public IList<BLL.StatusText> GetAll()
        {
            IList<BLL.StatusText> statusalllist = new List<BLL.StatusText>();
            using (TrainingWorkshopEntities db = new TrainingWorkshopEntities())
            {
                IList<StatusText> statustextDE = new List<StatusText>();
                statustextDE = (from m in db.StatusTexts select m).ToList();
                if (statustextDE != null)
                {
                    foreach (StatusText StatusTextDE in statustextDE)
                    {
                        BLL.StatusText statustextBE = StatusTextTranslator.TranslateToRStatusTextBE(StatusTextDE);

                        statusalllist.Add(statustextBE);
                    }
                }
                
                return statusalllist;
            }
        }
    }
}

          

